<%@page language="java" pageEncoding="UTF-8"%>
<%@page import="org.firecloud.h5fun.model.javabean.*"%>
<%@page import="java.util.List"%>
<%@page import="org.firecloud.h5fun.model.CommonConfig"%>
<%
	CommonConfig webconfig = (CommonConfig) request.getServletContext().getAttribute("commonConfig");
	SearchQueryBean search = (SearchQueryBean) session.getAttribute("searchQuery");
	@SuppressWarnings("unchecked")
	List<ColumnBean> colums = (List<ColumnBean>) (application.getAttribute("columns"));
	String[] orderByNames = webconfig.getOrderByNames();
	String[] orderByTypes = webconfig.getOrderByTypes();
	int maxPage = (Integer) request.getAttribute("maxPage");
	int currentPage = (Integer) request.getAttribute("currentPage");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/common.css" type="text/css" rel="stylesheet" />
<link href="css/icon.css" type="text/css" rel="stylesheet" />
<title><%=webconfig.getTitle()%></title>
</head>
<body>
	<div class="doc">
		<jsp:include page="widget-head.jsp">
			<jsp:param value='<%=search.getColumnId()%>' name="activeColumnId" />
		</jsp:include>
		<div class="main-context">
			<div class="search-arg">
				<div class="search-arg-cell search-arg-name">返回结果：</div>
				<div class="search-arg-cell search-arg-cell-active"><%=request.getAttribute("resultSetSize")%>个
				</div>
			</div>
			<div class="search-arg">
				<div class="search-arg-cell search-arg-name">搜索关键字：</div>
				<div class="search-arg-cell search-arg-cell-active">
					“<%=search.getStr() == null ? "" : search.getStr()%>”
				</div>
			</div>
			<div class="search-arg">
				<div class="search-arg-cell search-arg-name">搜索范围：</div>
				<a href="Search?columnId=0"><div
						class="search-arg-cell <%=0 == search.getColumnId() ? "search-arg-cell-active" : ""%>">全部</div></a>
				<%
					for (ColumnBean column : colums) {
				%>
				<a href="Search?columnId=<%=column.getId()%>"><div
						class="search-arg-cell <%=column.getId() == search.getColumnId() ? "search-arg-cell-active" : ""%>"><%=column.getName()%></div></a>
				<%
					}
				%>
			</div>
			<div class="search-arg">
				<div class="search-arg-cell search-arg-name">排序根据：</div>
				<%
					for (byte i = 0; i < orderByNames.length; ++i) {
				%>
				<a href="Search?orderBy=<%=i%>"><div
						class="search-arg-cell <%=i == search.getOrderBy() ? "search-arg-cell-active" : ""%>"><%=orderByNames[i]%></div></a>
				<%
					}
				%>
			</div>
			<div class="search-arg">
				<div class="search-arg-cell search-arg-name">排序方式：</div>
				<%
					for (byte i = 0; i < orderByTypes.length; ++i) {
				%>
				<a href="Search?desc=<%=i%>"><div
						class="search-arg-cell <%=i == search.getDesc() ? "search-arg-cell-active" : ""%>"><%=orderByTypes[i]%></div></a>
				<%
					}
				%>
			</div>
		</div>
		<div class="main-context">
			<div class="search-arg">
				<a href="Search?page=0"><div class="search-arg-cell">
						<i class="icon-first"></i>
					</div></a>
				<%
					for (int i = currentPage - 4; i < currentPage + 4; ++i) {
						if (i >= 0 && i <= maxPage) {
				%>
				<a href="Search?page=<%=i%>"><div
						class="search-arg-cell <%=i == currentPage ? "search-arg-cell-active" : ""%>"><%=i + 1%></div></a>
				<%
					}
					}
				%>
				<a href="Search?page=<%=maxPage%>"><div class="search-arg-cell">
						<i class="icon-last"></i>
					</div></a>
			</div>
		</div>
		<div class="main-context">
			<jsp:include page="widget-projects-image.jsp">
				<jsp:param name="dataName" value="resultSet" />
			</jsp:include>
			<div class="clear-both"></div>
		</div>
		<jsp:include page="widget-foot.jsp" />
	</div>
</body>
</html>
